<%@ page import="org.tailor.Fabric"%>
<html>
<head>

<meta name="layout" content="mainLayout" />
<g:set var="entityName"
	value="${message(code: 'fabric.label', default: 'Fabric')}" />


</head>
<body>
	<div id="col_middle">
		<div class="body">
			<h1>
				<g:message code="default.edit.label" args="[entityName]" />
			</h1>
			<g:if test="${flash.message}">

			</g:if>

			<div class="errors">
				<g:renderErrors bean="${fabricInstance}" as="list" />
			</div>
				<g:form  method="post" controller="fabric" action="save" enctype="multipart/form-data">
				<g:hiddenField name="id" value="${fabricInstance?.id}" />
				<g:hiddenField name="version" value="${fabricInstance?.version}" />
				<div class="dialog">
					<table>
						<tbody>

							<tr class="prop">
								<td valign="top" class="name"><label for="fabricID"><g:message
											code="fabric.fabricID.label" default="Fabric ID" />
								</label></td>
								<td valign="top"
									class="value ${hasErrors(bean: fabricInstance, field: 'fabricID', 'errors')}">
									<g:textField name="fabricID"
										value="${fieldValue(bean: fabricInstance, field: 'fabricID')}" />
									<br />
								<br /></td>
							</tr>

							 <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="fabric"><g:message code="fabric.fabricName.label" default="FabricName" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: fabricInstance, field: 'fabricName', 'errors')}">
                                    <g:select name="fabricName" from="${org.tailor.Fabric.list()}" optionKey="fabricName"  optionValue="fabricName" />
                                  <br/><br/>
                                </td>
                            </tr>
							<tr class="prop">
								<td valign="top" class="name"><g:message
										code="fabric.fabricPicture.label" default="Fabric Picture" />
								</td>

								<td valign="top" class="value"><img
									src="<g:createLink controller='fabric' action='renderImage' id='${fieldValue(bean: fabricInstance, field:"id")}'/>"
									width="120" height="120"
									title="${fieldValue(bean: fabricInstance, field:"id")}"
									alt="No Photo" /> <br/><br/>
									</td>
									
									
									
									<tr><td></td>
									<td valign="top"
								class="value ${hasErrors(bean: fabricInstance, field: 'fabricPicture', 'errors')}">
                                <input type="file"  name="fabricPicture"  id="fabricPicture" size="10" />  								
								<br/><br/>
								</td>
							
							</tr>

							<tr class="prop">
								<td valign="top" class="name"><label for="code"><g:message
											code="fabric.code.label" default="Code" />
								</label></td>
								<td valign="top"
									class="value ${hasErrors(bean: fabricInstance, field: 'code', 'errors')}">
									<g:textField name="code"
										value="${fieldValue(bean: fabricInstance, field: 'code')}" />
									<br />
								<br /></td>
							</tr>

							<tr class="prop">
								<td valign="top" class="name"><label for="date"><g:message
											code="fabric.date.label" default="Date" />
								</label></td>
								<td valign="top"
									class="value ${hasErrors(bean: fabricInstance, field: 'date', 'errors')}">
									<g:datePicker name="date" precision="day"
										value="${fabricInstance?.date}" /> <br />
								<br /></td>
							</tr>

							<tr class="prop">
								<td valign="top" class="name"><label for="description"><g:message
											code="fabric.description.label" default="Description" />
								</label></td>
								<td valign="top"
									class="value ${hasErrors(bean: fabricInstance, field: 'description', 'errors')}">
									<g:textField name="description"
										value="${fabricInstance?.description}" /> <br />
								<br /></td>
							</tr>
							
							<tr class="prop">
								<td valign="top" class="name"><label for="fabric"><g:message
											code="fabric.fabricType.label" default="Fabric Type" />
								</label></td>
								 <td valign="top" class="value ${hasErrors(bean: fabricInstance, field: 'fabricType', 'errors')}">
                                    <g:select name="fabricType" from="${org.tailor.Fabric.list()}" optionKey="fabricType" value="${fabricType}"  optionValue="fabricType" />
                                  <br/><br/>
                                </td>
							</tr>

							<tr class="prop">
								<td valign="top" class="name"><label for="imported"><g:message
											code="fabric.imported.label" default="Imported" />
								</label></td>
								<td valign="top"
									class="value ${hasErrors(bean: fabricInstance, field: 'imported', 'errors')}">
									<g:textField name="imported"
										value="${fieldValue(bean: fabricInstance, field: 'imported')}" />
									<br />
								<br /></td>
							</tr>

							<tr class="prop">
								<td valign="top" class="name"><label for="price"><g:message
											code="fabric.price.label" default="Price" />
								</label></td>
								<td valign="top"
									class="value ${hasErrors(bean: fabricInstance, field: 'price', 'errors')}">
									<g:textField name="price"
										value="${fieldValue(bean: fabricInstance, field: 'price')}" />
									<br />
								<br /></td>
							</tr>

							<tr class="prop">
								<td valign="top" class="name"><label for="regionUsed"><g:message
											code="fabric.regionUsed.label" default="Region Used" />
								</label></td>
								<td valign="top"
									class="value ${hasErrors(bean: fabricInstance, field: 'regionUsed', 'errors')}">
									<g:textField name="regionUsed"
										value="${fabricInstance?.regionUsed}" /> <br />
								<br /></td>
							</tr>

						</tbody>
					</table>
				</div>
				<div class="buttons">
					 <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span> 
					 <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}"
							onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
					</span>
				</div>
			</g:form>
		</div>
	</div>
</body>
</html>
